from key_word.KeyWord import WebKeys
from locater.allPages import *
from logic.create_chapter import CreateChapterLogic


class DelChapter(WebKeys):
    # 读书屋-删除章节
    def delChapterLogic(self,title):
        # 核心：复用创建流程
        create_chapter = CreateChapterLogic(self.driver) # 调用的类中已经集成了工具类，所以可以直接实用调用类中集成工具类中的方法
        create_chapter.createChapter(chapter_name=title,chapter_content='cc')

        # 删除流程
        Chapter_del_btn = [By.XPATH,f"//td[contains(text(),{title})]/..//a[contains(text(),'删除')]"]
        self.locator_with_wait(*Chapter_del_btn).click()
        self.locator_with_wait(*page_authorManage_ChapterList_del_btn_True).click()

